<?php
/** 
 *  1.Define base patch
 *  2.Define path to application directory
 *  3.Define application environment
 *  4.Ensure library/ is on include_path
 *  5.require Application.php
 *  6.
 */
// 1.Define base patch
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));

// 2.Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

// 3.Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// 4.Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    BASE_PATH . '/library',
//    APPLICATION_PATH . '/models/Table',
    get_include_path(),
)));

// 5. Zend_Application
require_once 'Zend/Application.php';

// 6.new application -> run()
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();